package com.weijianhuawen.wjblog.common.config;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;

import java.util.List;

/**
 * @version: java version 8
 * @Author: weijianhuawen
 * @description: sql 注入器
 * @date: 2024-10-25 19:25
 */
public class InsertBatchSqlInjector extends DefaultSqlInjector {

    @Override
    public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
        //通过父类方法保留mybatisplu自带的方法
        List<AbstractMethod> methods = super.getMethodList(mapperClass, tableInfo);

        //添加自定义方法 批量插入
        methods.add(new InsertBatchSomeColumn());
        return methods;
    }
}
